package com.example.NeteaseCloudMusicApi.ui.activity;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.NeteaseCloudMusicApi.R;
import com.example.NeteaseCloudMusicApi.entity.ListSong;
import com.example.NeteaseCloudMusicApi.ui.adapter.ListSongAdapter;

import java.util.ArrayList;
import java.util.List;

public class ListSongActivity extends AppCompatActivity {
    RecyclerView recyclerView;
    ListSongAdapter adapter;
    private List<ListSong> listSongs = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initSong();
        recyclerView = findViewById(R.id.recyclerview);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        adapter = new ListSongAdapter(listSongs);
        recyclerView.setAdapter(adapter);
    }

    private void initSong() {
        for (int i = 0; i < 50; i++) {
            ListSong songs = new ListSong((i+1)+"","wang","wang","wang");
            listSongs.add(songs);
        }
    }
}

